#include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef long long LL;
const int N = 1e3 + 10;
int n;
int a[N], b[N];
int ans[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 0; i <= n; i++) {
			a[i] = b[i] = 0;
			ans[i] = -1;
		}
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
		}
		if (n == 1) {
			cout << -1 << endl;
			continue;
		}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (!b[j] && a[i] != j) {
					ans[i] = j;
					b[j] = 1;
					break;
				}
			}
		}
		if (ans[n] == -1) {
			ans[n] = ans[n - 1];
			ans[n - 1] = n;
		}
		for (int i = 1; i <= n; i++) {
			cout << ans[i] << " ";
		}
		cout << endl;
	}
	return 0;
}